package edu.sctu.practice.class02.hujie.online_classes_practice.imooc.Java_IO.class6to1;

import java.io.*;

/**
 * Created by hp on 2015/12/22.
 */
public class ObjectSeriaDemo1 {
    public static void main(String[] args) throws IOException, ClassNotFoundException {
        String file="F:\\桌面文件\\慕课网笔记\\文件传输基础IO流\\2.dat";
//        1、对象的序列化
//        ObjectOutputStream oos=new ObjectOutputStream(new FileOutputStream(file));
//        Student stu=new Student("10001","胡杰",20);
//        oos.writeObject(stu);
//        oos.flush();
//        oos.close();
        ObjectInputStream ois=new ObjectInputStream(new FileInputStream(file));
        Student stu=(Student)ois.readObject();
        System.out.println(stu);
        ois.close();
    }
}
